var express = require('express');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

router.get('/list', function(req, res, next) {
  // res.send('respond add request');
  var redis = require('redis');
  var port = 6379;
  var host = '127.0.0.1';
  var client = redis.createClient();
  var obj = {};
//  var obj = new Object();

//  client.on('connect', function() {
//    console.log('connected');
//  });

  client.get('sname', function(err, reply) {
    console.log(reply);
    obj.sname = reply;
    res.render('listuser', {'obj': obj});
  });

  client.quit();

  // console.log(obj);

  // var obj = {'sno': 1, 'sname': 'zhou'};
  // res.render('listuser', {'obj': obj});  

});

module.exports = router;
